<html>
<head><meta charset="utf-8"><title>Auto imports in VSCode · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Auto.20imports.20in.20VSCode.html">Auto imports in VSCode</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210206753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Auto%20imports%20in%20VSCode/near/210206753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eryn <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Auto.20imports.20in.20VSCode.html#210206753">(Sep 15 2020 at 23:55)</a>:</h4>
<p>with rust-analyzer, import prompts are surfaced with the "quick fix" menu: <a href="/user_uploads/4715/R5fj559t-E7dps4TvJKsG5y8/image.png">image.png</a> </p>
<div class="message_inline_image"><a href="/user_uploads/4715/R5fj559t-E7dps4TvJKsG5y8/image.png" title="image.png"><img src="/user_uploads/4715/R5fj559t-E7dps4TvJKsG5y8/image.png"></a></div><p>In other languages, this is surfaced in the auto complete  <a href="/user_uploads/4715/EgjjU-EG8rIffKCSayoZaQZo/image.png">image.png</a>  and as a "preferred quick fix" on the side indicated with the blue light bulb. </p>
<div class="message_inline_image"><a href="/user_uploads/4715/EgjjU-EG8rIffKCSayoZaQZo/image.png" title="image.png"><img src="/user_uploads/4715/EgjjU-EG8rIffKCSayoZaQZo/image.png"></a></div><p>I would really prefer it if you were able to auto import things with the auto complete menu instead of with the quick fix, because it's different than all the other languages I use and it uses a different keyboard shortcut in VS Code</p>



<a name="210207011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Auto%20imports%20in%20VSCode/near/210207011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Auto.20imports.20in.20VSCode.html#210207011">(Sep 15 2020 at 23:58)</a>:</h4>
<p>This might not even be terribly difficult to implement nowadays :)</p>



<a name="210259572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Auto%20imports%20in%20VSCode/near/210259572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Auto.20imports.20in.20VSCode.html#210259572">(Sep 16 2020 at 13:18)</a>:</h4>
<p>Yeah! If you look at <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#textDocument_completion">https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#textDocument_completion</a> <code>additionalTextEdits</code>can be specified and indeed the comment is:</p>
<blockquote>
<ul>
<li>Additional text edits should be used to change text unrelated to the current cursor position<br>
     * (for example adding an import statement at the top of the file if the completion item will<br>
     * insert an unqualified type).</li>
</ul>
</blockquote>



<a name="210259803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Auto%20imports%20in%20VSCode/near/210259803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Auto.20imports.20in.20VSCode.html#210259803">(Sep 16 2020 at 13:20)</a>:</h4>
<p>In 3.16 <code>resolve</code> support was added to delay that computation as a performance enhancement</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>